/**
 * @Author MrsGuo
 * version 1.0
 * @Date 2023-08-14 10:42
 */
package com.cl.erp_2301.Service.impl;


import com.cl.erp_2301.Service.ReturnService;
import com.cl.erp_2301.dto.ReturnDTO;

import com.cl.erp_2301.mapper.ReturnMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional(rollbackFor = {Exception.class,RuntimeException.class})
@Service
public class ReturnServiceImpl implements ReturnService {
    @Resource
    private ReturnMapper returnMapper;

    @Override
    public String selectTypeByGoodsuuid(Integer goodsuuid) {
        return returnMapper.selectTypeByGoodsuuid(goodsuuid);
    }

    @Override
    public Integer addReturnOrders(List<ReturnDTO> returnOrdersDTOList) {
     Integer i=returnMapper.addReturnOrders(returnOrdersDTOList);
       for (ReturnDTO returnOrdersDTO : returnOrdersDTOList){
          returnOrdersDTO.setReturnordersuuid(returnOrdersDTO.getUuid());
       }
       returnMapper.addReturnOrdersDetail(returnOrdersDTOList);
       return i;
    }

    @Override
    public Integer selectStoreId(Integer goodsuuid) {
        return returnMapper.selectStoreId(goodsuuid);
    }
}
